package Listeners;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import GUI.AuthorToolPanel;
import GUI.ConferenceWizardFrame;
import Model.Conference;
import Model.Paper;
import Model.User;

/**
 * It should take a File object and then add it to Conference.
 * It assumes that all it needs to do is make some checks and then
 * add the previously created paper object to the conference class in 
 * question.
 * 
 * @author Nathan Judkins
 */
@SuppressWarnings("serial")
public class SubmitPaperListener extends AbstractAction
{
  private final Conference my_conference;
  private final Paper my_paper;
  private ConferenceWizardFrame my_frame;
  private final User my_author;
  
  public SubmitPaperListener(ConferenceWizardFrame the_frame, Conference the_conference, 
      Paper the_authors_paper, User the_author) 
  {
    my_frame = the_frame;
    my_conference = the_conference;
    my_paper = the_authors_paper;
    my_author = the_author;
  }

  /**
   * Assumed that the Paper object is not null at this point
   */
  @Override
  public void actionPerformed(ActionEvent arg0)
  {
    my_conference.addPaper(my_paper);
    my_frame.setCurrentPanel(new AuthorToolPanel(my_conference, my_author, my_frame)); //Where the Panel should go back to after submitting
  }
}
